//
//  ViewController.m
//  06-QQ
//
//  Created by 韩旭 on 16/7/21.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
//    设置状态栏为白色
    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.00 green:0.71 blue:0.98 alpha:1.00];
     [self creatImage];
    [self creatSegment];
}
- (void)creatImage {
    UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
    image.image = [UIImage imageNamed:@"touxiang"];
    image.layer.masksToBounds = YES;
    UIButton *btnLeft = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    [btnLeft setImage:[UIImage imageNamed:@"touxiang"] forState:UIControlStateNormal];
    btnLeft.layer.masksToBounds = YES;
    btnLeft.layer.cornerRadius = 20;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btnLeft];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:nil];
    self.navigationController.navigationBar.backgroundColor = [UIColor redColor];
}
- (void)creatSegment {
    UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:@[@"消息", @"电话"]];
    segment.layer.borderWidth = 2;
    segment.layer.cornerRadius = 10;
    segment.layer.borderColor = [UIColor whiteColor].CGColor;
    segment.frame = CGRectMake(0, 0, 125, 30);
    segment.selectedSegmentIndex = 0;
    self.navigationItem.titleView = segment;
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    segment.layer.masksToBounds = YES;
    self.navigationItem.titleView.layer.borderColor = [UIColor whiteColor].CGColor;
}
@end
